﻿using Library.OrmEnterpriseEntity.TableInfo;
namespace Library.OrmEnterpriseEntity {
	/// <summary>
	/// Relation mapping between tables
	/// </summary>
	public struct RelationDetailView {
		private readonly DbColumnView _column;

		/// <summary>
		/// Parent column in relation
		/// </summary>
		private readonly DbColumnView _refColumn;

		/// <summary>
		/// Constant value in relation in the case the RefColmn is null
		/// </summary>
		private readonly object _columnValue;



		/// <summary>
		/// type of relation
		/// </summary>
		private readonly RelationDetailType _relationType;
		/// <summary>
		/// 
		/// </summary>
		/// <param name="column"></param>
		/// <param name="refColumn"></param>
		/// <param name="value"></param>

		/// <param name="relationType"></param>
		public RelationDetailView(DbColumnView column, DbColumnView refColumn, object value, RelationDetailType relationType) {
			_column = column;
			_refColumn = refColumn;
			_columnValue = value;
			_relationType = relationType;
		}
		/// <summary>
		/// The column in relation
		/// </summary>
		public DbColumnView Column { get { return _column; } }
		/// <summary>
		/// Parent column in relation
		/// </summary>
		public DbColumnView RefColumn { get { return _refColumn; } }
		/// <summary>
		/// Constant value in relation in the case the RefColmn is null
		/// </summary>
		public object Value { get { return _columnValue; } }

		/// <summary>
		/// type of relation
		/// </summary>
		public RelationDetailType RelationType { get { return _relationType; } }
	}
}
